<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
    <META content="IE=7.0000" http-equiv="X-UA-Compatible">
    <TITLE>无标题页</TITLE>
    <META content="text/html; charset=utf-8" http-equiv=Content-Type>
    <LINK rel=stylesheet type=text/css href="__PUBLIC__/Css/Style.css">
    <LINK rel=Stylesheet type=text/css href="__PUBLIC__/css/jquery-ui-1.8.16.custom.css">
    <LINK rel=Stylesheet type=text/css href="__PUBLIC__/css/jquery.cropzoom.css">
    <script  type="text/javascript"
             src="__PUBLIC__/libs/js/jquery.js">
    </script>
    <style>
        * {
            font-size: 12px;
        }

        .buttons {
            line-height: 30px;
            height: 30px;
            width: 80px;
        }
    </style>
    <script type="text/javascript">
       	$(document).ready(function(){
        	
    		  $("#company").blur(function(){	        		  	    	
        		  get_url = "__APP__/Custom/checkName";
        		  var company = $('#company').val();
        		  var id=$('#id').val();

        		  $.ajax({
			            url:get_url,
			            type:'POST',
			            data:{'company':company,'id':id},
			            cache:false,
			            dataType:"json",
			            success:function(data,status){
				            //alert("data:"+data+"data.status:"+data.status+"data.errMsg:"+data.errMsg);
			                if(data.status == "success"){
			                    $('#error').show();
			                    $('#error').html(data.errMsg);
			                   // if(data.errMsg=='修改成功'){
			                       // close();
			                   // }
			                }else{
			                    $('#error').show();
			                    $('#error').html(data.errMsg);
			                }
			            }
			        });
    		  });



            $("#tel").blur(function(){
                get_url = "__APP__/Custom/checktel";
                var tel = $('#tel').val();
                var id=$('#id').val();

                $.ajax({
                    url:get_url,
                    type:'POST',
                    data:{'tel':tel,'id':id},
                    cache:false,
                    dataType:"json",
                    success:function(data,status){
                        //alert("data:"+data+"data.status:"+data.status+"data.errMsg:"+data.errMsg);
                        if(data.status == "success"){
                            $('#error1').show();
                            $('#error1').html(data.errMsg);
                            // if(data.errMsg=='修改成功'){
                            // close();
                            // }
                        }else{
                            $('#error1').show();
                            $('#error1').html(data.errMsg);
                        }
                    }
                });
            });


    	});
        
    	
    </script>
    <script type="text/javascript">
        function check(fr) {
            if (fr.cname.value == "") {
                alert('负责人不能为空！');
                fr.cname.focus();
                return false
            }
            if (fr.company.value == "") {
                alert('公司名称不能为空！');
                fr.company.focus();
                return false
            }
            if (fr.tel.value == "") {
                alert('电话号码不能为空！');
                fr.tel.focus();
                return false
            }
            return true
        }

        window.onload = function () {
            document.getElementById("company").focus();
            window.parent.frmright.aaa();
        }
    </script>
</HEAD>
<BODY>
<DIV class="infoBox" id="infoBox">
    <form id="form1" onSubmit="return check(this)" name="form1" method="post" action="__ROOT__/system.php/Custom/save">
        <TABLE width="100%" border=0 align="left" cellPadding=0 cellSpacing=0>
            <TBODY>
            <TR>
                <TD class=infoBoxTd width=68>公司名称：</TD>
                <TD width="446">
                    <INPUT style="WIDTH: 300px" id="company" class="formTitle" name="company"  value="{$custom.company}" >
                    <input id="id" name="id" type="hidden"   value="{$custom.id}" />
                   <SPAN  ></SPAN><LABEL>必须填写</LABEL> <span id="error"></span> </TD>
            </TR>
            <TR>
                <TD class=infoBoxTd width=68>负责人：</TD>
                <TD width="446"><INPUT style="WIDTH: 300px" id="cname" class="formTitle" name="cname" value="{$custom.cname}">
                    <SPAN  id="box_N_Title"></SPAN><LABEL>必须填写</LABEL></TD>
            </TR>
            <TR>
                <TD class=infoBoxTd width=68>联系电话：</TD>
                <TD width="446"><INPUT style="WIDTH: 300px" id="tel" class="formTitle" name="tel" value="{$custom.tel}" />
                    <SPAN  ></SPAN><LABEL>必须填写</LABEL> <span id="error1"></span></TD>
            </TR>
            <TR>
                <TD class=infoBoxTd width=68>客户地址：</TD>
                <TD width="446"><INPUT style="WIDTH: 300px" id="address" class="formTitle" name="address"  value="{$custom.address}" /></TD>
            </TR>
            <TR>
             <TD class=infoBoxTd width=68>客户所在区域：</TD>
                <TD width="446">
                   <select name="area" style="WIDTH: 300px">
                        <volist name="areaList" id="vo">
                            <option value="{$vo['area_id']}"  <?php
                             if($vo['area_id']==(int)$custom['area_id'])
                               echo ' selected="selected" ';
                            ?>
                            >
                             {$vo['area_name']}</option>
                        </volist>
                     </select>
                </TD>
            </TR>
            <TR>
                <TD class=infoBoxTd width=68>QQ：</TD>
                <TD width="446"><INPUT style="WIDTH: 300px" id="qq" class="formTitle" name="qq"  value="{$custom.qq}"></TD>
            </TR>
            <TR>
                <TD class=infoBoxTd width=68>主营产品：</TD>
                <TD width="446"><INPUT style="WIDTH: 300px" id="userproduct" class="formTitle" name="userproduct"  value="{$custom.userproduct}"></TD>
            </TR>
            <TR>
                <TD class=infoBoxTd width=68>推销产品：</TD>
                <TD width="446">
                    <select name="product" class="selector" style="WIDTH: 300px">
                        <volist name="productlist" id="vo">
                            <option value="{$vo['id']}" <?php
                                    if((int)$custom['product']==$vo['id'])
                                    echo ' selected="selected" ';  ?> >{$vo['name']}</option>
                        </volist>
                    </select>
                </TD>
            </TR>
            <TR>
                <TD class=infoBoxTd width=68>客户类型：</TD>
                <TD width="446">
                    <UL class=virtue>
                         <volist name="custtypelist" id="vo">
                            <LI>{$vo['name']}
                                <INPUT name="level" value="{$vo['id']}" type="radio" <?php if((int)$custom['level']==$vo['id']) echo 'checked'?> /></LI>
                        </volist>

                    </UL>

                </TD>
            </TR>
            <TR>
                <TD class=infoBoxTd>&nbsp;</TD>
                <TD>
                    <input class="buttons" type="submit" value="保存数据"/>
                    <input name="action" type="hidden"   value="{$action}" />
                </TD>
            </TR>
            </TBODY>
        </TABLE>
    </FORM>
</DIV>

</BODY>
</HTML>